<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsp/common/include.inc.jsp"%>
<div class="easyui-layout"  style="width:100%;height:100%" data-options="border:false,fit:true">
<div data-options="region:'north'" border="false" style=" padding:10px 1px 1px 1px;">
<div class="row-fluid">
				<div class="span12">
					<form action="#" method="get" class="form-inline form-validation " data-grid-search="menuTable">
					       <select name="pager.property" class="input-medium">
								<option value="search['CN_code']">代码</option>
								<option value="search['CN_title']">名称</option>
							</select>
						    <input type="text" name="searchKey" id="searchKey" value="" class="input-xlarge"/>  
							
							<span class="input-append">
								<button class="btn green" type="submmit">
									<i class="icon-search"></i>&nbsp; 查&nbsp;询
								</button>
								<button class="btn default" type="reset">
									<i class="icon-undo"></i>&nbsp; 重&nbsp;置
								</button>
							</span>
					

					</form>
				</div>
			</div>


<div style="background:#efefef;padding:3px 5px;">

<a id="add" href="#" data-toggle="win-edit" title="菜单管理" dataUrl="${base}/sys/menu/create.action" dataGridId="menuTable" class="easyui-linkbutton" callFun="menuTable_dataload"  data-options="plain:true,iconCls:'easyUIicon-add'">新建</a>
<a id="edit" href="#" callFun="menuTable_dataload" data-toggle="win-edit" title="菜单管理" dataUrl="${base}/sys/menu/edit.action" dataGridId="menuTable" idField="id" class="easyui-linkbutton" data-options="plain:true,iconCls:'easyUIicon-edit'">修改</a>

<a id="edit" href="#" callFun="menuTable_dataload" data-toggle="data-del" dataUrl="${base}/sys/menu/doDelete.action" dataGridId="menuTable" class="easyui-linkbutton" data-options="plain:true,iconCls:'easyUIicon-remove'">删除</a>	

</div>

</div>
<div data-options="region:'center'" border="false"> 
<table  id="menuTable">

</table>
</div>

</div>

<script type="text/javascript">
<!--
		function formatColumn(colName, value, row, index) {
			return eval("row."+colName);
		}

	function menuTable_dataload(){	 
        $('#menuTable').treegrid('options').url = '${base}/sys/menu/getTree.action?beanId=menuService&loadAllNodes=false';
        $('#menuTable').treegrid('reload'); 
    }
	$(function(){

          $('#menuTable').treegrid({
			    title:"菜单列表",
				width:'100%',
				height:'520',
				fitColumns:true,
				autoRowHeight:false,
				url:"${base}/sys/menu/getTree.action?beanId=menuService&loadAllNodes=false",
				idField:'id',
				treeField:'text',

                onBeforeLoad:function(row,param){
					 if (row){
					   $(this).treegrid('options').url = '${base}/sys/menu/getTree.action?beanId=menuService&loadAllNodes=false&id='+row.id;
					 } else {
					   $(this).treegrid('options').url = '${base}/sys/menu/getTree.action?beanId=menuService&loadAllNodes=false';
					 }
				},
				columns:[[
					{title:'名称',field:'text',width:100},
	                {title:'代码',field:'code',width:100,formatter:function(v,r,i){return formatColumn('attributes.code',v,r,i);}},
	                {title:'URL',field:'attributes.url',width:180,formatter:function(v,r,i){return formatColumn('attributes.url',v,r,i);}},
					{title:'排序号',field:'not field',width:100,formatter:function(v,r,i){return formatColumn('attributes.orderRank',v,r,i);}}
					
				]]
			});
	});
//-->
</script>